<template>
  <div class="risk">
    <page-tab-list
      :url="this.$constUrl.ZXTF_AchievementsTaskDts_GetPageData"
      :params="params"
      @initList="_initList"
    >
      <van-cell class="card" v-for="(dataItem, index) in list" :key="index">
        <template>
          <div @click="goView(dataItem)">
            <van-row>
              <van-col span="24"
                ><div class="title">
                  任务名称：{{ dataItem.TaskName }}
                </div></van-col
              >
            </van-row>
            <van-row>
              <van-col span="11">总分：{{ dataItem.TotalScore }}</van-col>
              <van-col span="13"
                >合格分数：{{ dataItem.StandardScore }}</van-col
              >
            </van-row>
            <van-row>
              <van-col span="11"> 自评人：{{ dataItem.SelfTaskUserOrg }} </van-col>
              <van-col span="13">
                自评得分：<span v-if="dataItem.SelfScore>=dataItem.StandardScore" class="c-green">{{ dataItem.SelfScore }}</span>
                <span v-if="dataItem.SelfScore<dataItem.StandardScore" class="c-red">{{ dataItem.SelfScore }}</span>
              </van-col>
            </van-row>
            <van-row v-if="dataItem.PublishDate == null">
              <van-col span="24"
                >考评人：{{ dataItem.OtherTaskUserOrgName }}</van-col
              >
            </van-row>
            <van-row v-else>
              <van-col span="24">
                考评人：{{ dataItem.OtherTaskUserOrgName }}
              </van-col>
            </van-row>
            <van-row v-if="dataItem.PublishDate != null">
              <van-col span="11">
                考评得分：<span v-if="dataItem.AllScore>=dataItem.StandardScore" class="c-green">{{ dataItem.AllScore }}</span>
                <span v-if="dataItem.AllScore<dataItem.StandardScore" class="c-red">{{ dataItem.AllScore }}</span>
              </van-col>
              <van-col span="13">
                考核完成时间：<span
                  >{{ dataItem.PublishDate | formatDate }}</span
                >
              </van-col>
            </van-row>
            <van-row>
              <van-col span="11">发起人：{{ dataItem.CreateChnName }}</van-col>
              <van-col span="13"
                >创建时间：{{ dataItem.CreateDate | formatDate }}</van-col
              >
            </van-row>
            <van-row>
              <van-col span="11"
                >开始时间：{{ dataItem.StartDate | formatDate }}</van-col
              >
              <van-col span="13"
                >结束时间：{{ dataItem.EndDate | formatDate }}</van-col
              >
            </van-row>
          </div>
          <van-row v-show="dataItem.PublishDate == null">
            <van-col span="24">
              <div class="dep_btm">
                <div class="btm_item" @click="goUpdate(dataItem)">
                  <van-icon name="notes-o" size="18" />
                  <div class="mr-10">考评</div>
                </div>
              </div>
            </van-col>
          </van-row>
        </template>
      </van-cell>
    </page-tab-list>
  </div>
</template>
     
<script>
import PageTabList from "@/components/PageTabList/PageTabList.vue";

export default {
  components: { PageTabList },
  data() {
    return {
      list: [],
      params: [
        {
          title: "待考评",
          dataType: "OtherList",
          dtsStatus: "0",
        },
        {
          title: "已考评",
          dataType: "OtherList",
          dtsStatus: "10",
        },
      ],
    };
  },
  methods: {
    _initList(list) {
      this.list = list;
    },
    goUpdate(item) {
      this.$router.push({
        path: "/OtherDetail",
        query: { ID: item.ID },
      });
    },
    goView(item) {
      if (item.PublishDate == null) {
        return;
      }
      this.$router.push({
        path: "/OtherView",
        query: { ID: item.ID },
      });
    },
  },
};
</script>
<style lang="less" scoped>
.card {
  .title {
    font-weight: bold;
  }
}

.dep_btm {
  display: flex;
  justify-content: flex-end;
  line-height: 27px;
  .btm_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}
</style>